# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html

import scrapy


class IndustryItem(scrapy.Item):
    '''
    行业数据
    '''
    name = scrapy.Field()
    code = scrapy.Field()
    sector_link = scrapy.Field()
    quotation_link = scrapy.Field()
    stock_bar_url = scrapy.Field()


class IndustryCapitalItem(scrapy.Item):
    '''
    行业资金
    '''
    industry_names = scrapy.Field()
    quotation_links = scrapy.Field()
    sector_links = scrapy.Field()


class SectorFundsItem(scrapy.Item):
    '''
    板块信息
    '''
    industry_name = scrapy.Field()  # '板块名称'
    industry_code = scrapy.Field()  # '板块code'
    open = scrapy.Field()  # '开盘价'
    close = scrapy.Field()  # '收盘价'
    high = scrapy.Field()  # '最高价'
    low = scrapy.Field()  # '最低价'
    preclose = scrapy.Field()  # '前收盘价',
    volume = scrapy.Field()  # '成交量（累计 单位：股）',
    amount = scrapy.Field()  # '成交额',
    inner = scrapy.Field()  # '内盘',
    outer = scrapy.Field()  # '外盘',
    peTTM = scrapy.Field()  # '流通市值	',
    pctChg = scrapy.Field()  # '涨跌幅',
    amplitude = scrapy.Field()  # '振幅',
    turn = scrapy.Field()  # '换手率',
    rising_nums = scrapy.Field()  # '上涨家数',
    decliner_nums = scrapy.Field()  # '下跌家数',
    flat_nums = scrapy.Field()  # '平家数',
    leading_stock = scrapy.Field()  # '领涨股票',
    main_inflow = scrapy.Field()  # 主力流入
    main_outflow = scrapy.Field()  # 主流流出
    main_net_inflow = scrapy.Field()  # '主力资金净流入',
    super_large_inflow = scrapy.Field()  # '超级大单资金净流入',
    large_inflow = scrapy.Field()  # '大单净流入',
    middle_inflow = scrapy.Field()  # '中单净流入',
    small_inflow = scrapy.Field()  # '小单净流入',
    create_time = scrapy.Field()


class StockMarketItem(scrapy.Item):
    '''
    大盘信息
    '''
    market_name = scrapy.Field()  # '大盘名称'
    market_code = scrapy.Field()  # '大盘code'
    open = scrapy.Field()  # '开盘价'
    close = scrapy.Field()  # '收盘价'
    high = scrapy.Field()  # '最高价'
    low = scrapy.Field()  # '最低价'
    preclose = scrapy.Field()  # '前收盘价',
    volume = scrapy.Field()  # '成交量（累计 单位：股）',
    amount = scrapy.Field()  # '成交额',
    inner = scrapy.Field()  # '内盘',
    outer = scrapy.Field()  # '外盘',
    peTTM = scrapy.Field()  # '流通市值	',
    pctChg = scrapy.Field()  # '涨跌幅',
    amplitude = scrapy.Field()  # '振幅',
    turn = scrapy.Field()  # '换手率',
    rising_nums = scrapy.Field()  # '上涨家数',
    decliner_nums = scrapy.Field()  # '下跌家数',
    flat_nums = scrapy.Field()  # '平家数',
    leading_stock = scrapy.Field()  # '领涨股票',
    main_inflow = scrapy.Field()  # 主力流入
    main_outflow = scrapy.Field()  # 主流流出
    main_net_inflow = scrapy.Field()  # '主力资金净流入',
    super_large_inflow = scrapy.Field()  # '超级大单资金净流入',
    large_inflow = scrapy.Field()  # '大单净流入',
    middle_inflow = scrapy.Field()  # '中单净流入',
    small_inflow = scrapy.Field()  # '小单净流入',
    create_time = scrapy.Field()


class StockInfoItem(scrapy.Item):
    '''
    板块——股票信息
    '''

    stock_code = scrapy.Field()
    stock_name = scrapy.Field()
    stock_detail_url = scrapy.Field()
    industry_name = scrapy.Field()
    stock_detail_url = scrapy.Field()
    market = scrapy.Field()


class StockFundsItem(scrapy.Item):
    '''
    股票涨幅+资金信息
    '''
    stock_name = scrapy.Field()  # '股票名称'
    stock_code = scrapy.Field()  # '股票code'
    open = scrapy.Field()  # '开盘价'
    close = scrapy.Field()  # '收盘价'
    high = scrapy.Field()  # '最高价'
    low = scrapy.Field()  # '最低价'
    average = scrapy.Field()  # 均价
    preclose = scrapy.Field()  # '前收盘价',
    volume = scrapy.Field()  # '成交量（累计 单位：股）',
    amount = scrapy.Field()  # '成交额',
    inner = scrapy.Field()  # '内盘',
    outer = scrapy.Field()  # '外盘',
    PE = scrapy.Field()  # 市盈率
    PB = scrapy.Field()  # 市净率
    total_value = scrapy.Field()  # 总市值
    cur_value = scrapy.Field()  # '流通市值	',
    pctChg = scrapy.Field()  # '涨跌幅',
    volume_ratio = scrapy.Field()  # '量比',
    turn = scrapy.Field()  # '换手率',
    # chip_ = scrapy.Field()  # 筹码集中度
    profit_ratio = scrapy.Field()  # 获利比例
    average_cost = scrapy.Field()  # 平均成本
    cost_90 = scrapy.Field()  # 90%成本
    cost_70 = scrapy.Field()  # 70%成本
    concentration_90 = scrapy.Field()  # 90%集中度
    concentration_70 = scrapy.Field()  # 70%集中度

    main_inflow = scrapy.Field()  # 主力流入
    main_outflow = scrapy.Field()  # 主流流出
    main_net_inflow = scrapy.Field()  # '主力资金净流入',
    super_large_inflow = scrapy.Field()  # '超级大单资金净流入',
    large_inflow = scrapy.Field()  # '大单净流入',
    middle_inflow = scrapy.Field()  # '中单净流入',
    small_inflow = scrapy.Field()  # '小单净流入',

    create_time = scrapy.Field()
    week_day = scrapy.Field()  # 周几   周一 1


class StockFundsHolderItem(scrapy.Item):
    '''
    股票涨幅+资金信息
    '''
    stock_name = scrapy.Field()  # '股票名称'
    stock_code = scrapy.Field()  # '股票code'
    open = scrapy.Field()  # '开盘价'
    close = scrapy.Field()  # '收盘价'
    high = scrapy.Field()  # '最高价'
    low = scrapy.Field()  # '最低价'
    average = scrapy.Field()  # 均价
    preclose = scrapy.Field()  # '前收盘价',
    volume = scrapy.Field()  # '成交量（累计 单位：股）',
    amount = scrapy.Field()  # '成交额',
    inner = scrapy.Field()  # '内盘',
    outer = scrapy.Field()  # '外盘',
    PE = scrapy.Field()  # 市盈率
    PB = scrapy.Field()  # 市净率
    total_value = scrapy.Field()  # 总市值
    cur_value = scrapy.Field()  # '流通市值	',
    pctChg = scrapy.Field()  # '涨跌幅',
    volume_ratio = scrapy.Field()  # '量比',
    turn = scrapy.Field()  # '换手率',

    main_net_inflow = scrapy.Field()  # '主力资金净流入',
    create_time = scrapy.Field()
    week_day = scrapy.Field()  # 周几   周一 1


class StockFundamentalItem(scrapy.Item):
    stock_name = scrapy.Field()
    stock_code = scrapy.Field()
    per_earnings = scrapy.Field()  # 每股收益ֵ'
    net_assets = scrapy.Field()  # 净资产
    net_profit = scrapy.Field()  # 净利润(亿)
    PE = scrapy.Field()  # 动态市盈率
    PB = scrapy.Field()  # 市净率
    gross_margin = scrapy.Field()  # 毛利率
    net_interest_rate = scrapy.Field()  # 净利率
    ROE = scrapy.Field()
    debt_ratio = scrapy.Field()  # 负债率
    UDPPS = scrapy.Field()  # '每股未分配利润(元)'
    market_time = scrapy.Field()  # 上市时间
    create_time = scrapy.Field()


class NewsItem(scrapy.Item):
    news_id = scrapy.Field()
    title = scrapy.Field()
    content = scrapy.Field()
    link = scrapy.Field()
    keys = scrapy.Field()
    industry = scrapy.Field()
    stock_code = scrapy.Field()
    source = scrapy.Field()
    publish_time = scrapy.Field()


class IndustryGrowthListItem(scrapy.Item):
    '''
    板块信息
    '''
    industry_name = scrapy.Field()  # '板块名称'
    industry_code = scrapy.Field()  # '板块code'
    now_price = scrapy.Field()  # '最新价格'
    volume_ratio = scrapy.Field()  # '成交量（累计 单位：股）',
    pctChg = scrapy.Field()  # '涨跌幅',
    turn = scrapy.Field()  # '换手率',
    rising_nums = scrapy.Field()  # '上涨家数',
    decliner_nums = scrapy.Field()  # '下跌家数',
    flat_nums = scrapy.Field()  # '平家数',
    leading_stock_code = scrapy.Field()  # '领涨股票',
    leading_stock_name = scrapy.Field()  # '领涨股票',
    main_net_inflow = scrapy.Field()  # '主力资金净流入',
    create_time = scrapy.Field()
    time_interval = scrapy.Field()


class IndustryStockListItem(scrapy.Item):
    '''
    板块涨幅-股票
    '''
    industry_name = scrapy.Field()  # '板块名称'
    industry_code = scrapy.Field()
    stock_name = scrapy.Field()  # '股票名称'
    stock_code = scrapy.Field()  # '股票code'
    now_price = scrapy.Field()  # '最新价格'
    pctChg = scrapy.Field()  # '涨跌幅',
    turn = scrapy.Field()  # '换手率',
    main_net_inflow = scrapy.Field()  # '主力资金净流入',
    create_time = scrapy.Field()
    time_interval = scrapy.Field()


class MarketWorkDayItem(scrapy.Item):
    '''
    大盘信息
    '''
    is_workday = scrapy.Field()
    create_date = scrapy.Field()
    create_time = scrapy.Field()
